package com.example.extra.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.extra.service.lmpl.VideoTypeServiceIml;
import com.example.extra.vo.SysTypeVideoVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.example.extra.common.R;

import java.util.List;

/**
 * @author lixiang
 */
@Slf4j
@Tag(name = "视频接口")
@RestController
@RequestMapping("/api/query-video")
@AllArgsConstructor
public class QueryPageVideoController {
    private final VideoTypeServiceIml videoTypeServiceIml;

  @GetMapping("getList")
  @Operation(summary = "多条件不分页查询视频")
     @Parameters({
            @Parameter(name = "type",description = "视频类型"),
            @Parameter(name = "name",description = "视屏名称")
    })
    public R<List<SysTypeVideoVo>> getVideoList(@RequestParam(required = false) String type,
                                                @RequestParam(required = false) String name){
        List<SysTypeVideoVo> videoList = videoTypeServiceIml.getVideoList(type,name);
        return R.ok("视频列表数据获取成功!",videoList);
    }

    @GetMapping("getPageList")
    @Operation(summary = "多条件分页查询视频")
     @Parameters({
            @Parameter(name = "type",description = "视频类型"),
            @Parameter(name = "name",description = "视屏名称"),
             @Parameter(name = "page",description = "当前页",required = true),
             @Parameter(name = "size",description = "分页大小",required = true),
    })
    public R<Page<SysTypeVideoVo>> getVideoPageList(@RequestParam(required = false) String type,
                                                    @RequestParam(required = false) String name,
                                                    @RequestParam int page, @RequestParam int size){
        Page<SysTypeVideoVo> videoPage = videoTypeServiceIml.queryPageVideoList(type,name,page,size);
        return R.ok("分页视频列表数据获取成功!",videoPage);
    }
}
